import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtils {

	/**
	 * boolean  isEmpty(String str )判断是否为空字符串 包括 “   ” 也算
	 * @param str
	 * @return
	 */
	public static boolean isEmpty(String str) {

		if (str != null && str.length() > 0 && str.trim().length()>0) {
			return true;
		}
		return false;
	}

	/**
	 * boolean  isPhone(Stirng phone)判断是否为手机号
	 * @param phone
	 * @return
	 */
	public static boolean isPhone(String phone) {

		boolean empty = isEmpty(phone);
		if (!empty) {
			return false;
		}

		Pattern pattern = Pattern.compile("^1[3|4|5|7|8][0-9]\\d{8}$");
		Matcher matcher = pattern.matcher(phone);
		if (matcher.matches()) {
			return true;
		}
		return false;
	}

	/**
	 * boolean  isemail(String email) 判断是否为邮箱
	 * @param email
	 * @return
	 */
	public static boolean isemail(String email) {

		boolean empty = isEmpty(email);
		if (!empty) {
			return false;
		}

		Pattern pattern = Pattern.compile("^([a-zA-Z0-9]+)@([a-zA-Z0-9]+\\.)+[a-zA-Z]{2,}$");
		Matcher matcher = pattern.matcher(email);
		if (matcher.matches()) {
			return true;
		}
		return false;
	}
	
	
}
